function subarraySum(nums: number[], k: number): number {
	let times = 0;

	for (let i = 0; i < nums.length; i++) {
		let sum = nums[i];

		if (sum === k) {
			times++;
		}

		for (let j = i + 1; j < nums.length; j++) {
			sum += nums[j];
			if (sum === k) {
				times++;
			}
		}
	}

	return times;
}
